<template>
  <view class="flyBarCont-footer">
    <view v-if="btnRole1" class="button-item" @click="onEvent('platoonCar')"> 排车 </view>
    <view v-if="btnRole2" class="button-item" @click="onEvent('addTempUse')"> 临时占用 </view>
    <view v-if="btnRole3" class="button-item" @click="onEvent('removeTempUse')"> 批量释放库存 </view>
  </view>
</template>

<script>
  import { usePermission } from '@/hooks/usePermission'

  export default {
    name: 'handle-picker',
    props: {
      modelValue: Boolean,
    },
    data() {
      return {
        btnRole1: usePermission('svmsapp:stock.platoonCar'),
        btnRole2: usePermission('svmsapp:stock.tempUse'),
        btnRole3: usePermission('svmsapp:stock.batchRemoveTempUse'),
      }
    },
    computed: {
      isHaveRole() {
        return this.btnRole1 || this.btnRole2 || this.btnRole3
      },
    },
    methods: {
      close() {
        this.$emit('update:modelValue', false)
      },
      onEvent(event) {
        this.$emit('ok', event)
      },
    },
  }
</script>

<style lang="scss" scoped>
  .flyBarCont-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 52px;
    width: 100%;

    .button-item {
      flex: 1;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 16px;
      font-weight: 400;
      color: #3072f6;
    }
    .button-item+.button-item {
      border-left: 1px solid rgba(229, 230, 235, 1);
    }
  }
</style>
